
package jz.dataCenter.faceLog;

import org.jdom.Element;

import SFPM.sysReport.ISystemStateReport;
import SFPM.sysReport.sysStateReportManager;
import SoftFan.jobQueue.jobQueueManager;
import SoftFan.util.xmlHelper;

public class FaceLogMgr implements ISystemStateReport {

	private static class SingletonHolder {

		private static FaceLogMgr	INSTANCE	= new FaceLogMgr();
	}

	public static FaceLogMgr getInstance() {
		return SingletonHolder.INSTANCE;
	}

	private jobQueueManager	queue;

	public FaceLogMgr() {
		super();
	}

	public void startup() {
		queue = new jobQueueManager("FaceLog");
		queue.startup();
		sysStateReportManager.getInstance().add(this);
	}

	public void shutdown() {
		sysStateReportManager.getInstance().remove(this);
		if (queue != null) {
			try {
				queue.shutdown();
			} finally {
				queue = null;
			}
		}
	}

	public jobQueueManager getQueue() {
		return queue;
	}

	public void outInfo(Element errContent, Element infoContent) {
		Element content = new Element("DvrClipMgr");
		infoContent.addContent(content);
		if (queue != null) {
			int queueSize = queue.getQueueSize();
			xmlHelper.writeTextTag(content, "FaceLogQueueSize", Integer.toString(queueSize));
		}
	}

}
